class BorrowRecsController < ApplicationController
  # GET /borrow_recs
  # GET /borrow_recs.xml
  def index
    @borrow_recs = BorrowRec.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @borrow_recs }
    end
  end

  def get_by_uid
    @borrow_recs = BorrowRec.find(:all, :conditions => "user_id = '#{params[:id]}'")
    render "index"
  end

  # GET /borrow_recs/1
  # GET /borrow_recs/1.xml
  def show
    @borrow_rec = BorrowRec.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @borrow_rec }
    end
  end

  # GET /borrow_recs/new
  # GET /borrow_recs/new.xml
  def new
    @borrow_rec = BorrowRec.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @borrow_rec }
    end
  end

  # GET /borrow_recs/1/edit
  def edit
    @borrow_rec = BorrowRec.find(params[:id])
  end

  # POST /borrow_recs
  # POST /borrow_recs.xml
  def create
    @borrow_rec = BorrowRec.new(params[:borrow_rec])

    respond_to do |format|
      if @borrow_rec.save
        flash[:notice] = 'BorrowRec was successfully created.'
        format.html { redirect_to(@borrow_rec) }
        format.xml  { render :xml => @borrow_rec, :status => :created, :location => @borrow_rec }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @borrow_rec.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /borrow_recs/1
  # PUT /borrow_recs/1.xml
  def update
    @borrow_rec = BorrowRec.find(params[:id])

    respond_to do |format|
      if @borrow_rec.update_attributes(params[:borrow_rec])
        flash[:notice] = 'BorrowRec was successfully updated.'
        format.html { redirect_to(@borrow_rec) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @borrow_rec.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /borrow_recs/1
  # DELETE /borrow_recs/1.xml
  def destroy
    @borrow_rec = BorrowRec.find(params[:id])
    @borrow_rec.destroy

    respond_to do |format|
      format.html { redirect_to(borrow_recs_url) }
      format.xml  { head :ok }
    end
  end
end
